#!/bin/sh
#
# Prepare PostgreSQL DBMS for labman2
# Use reinstall.sh to delete an existing labman2 and making a fresh one.

# You need to change DIR to labman2 base directory.

DIR=~/progs/labman2
cd $DIR

#sudo -u pgsql dropdb labman2
#sudo -u pgsql dropuser www
sudo -u pgsql createuser -d -S -l -R www || { 
  echo "User exists. Use reinstall.sh to reinstall"
  exit 1
}
sudo -u pgsql createdb labman2 || {
  echo "Database exists. Use reinstall.sh to reinstall"
  exit 1
}

./manage.py syncdb
